package com.erastep.util;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.earstep.connectionpool.ConnectionPoolFactory;

public class PropertyUtil {
	public static Log LOG = LogFactory.getLog(ConnectionPoolFactory.class);
	/**
	 * 加载配置文件
	 * 
	 * @param name
	 *            文件相对路径
	 * @return
	 */
	public static Properties loadProperties(String name) {
		Properties properties = new Properties();
		InputStream in;
		try {
			in = new BufferedInputStream(new FileInputStream(Class.class
					.getClass().getResource("/").getPath()
					+ name));
			properties.load(in);
		} catch (Exception e) {
			LOG.error(ConnectionPoolFactory.class + " 配置文件加载失败");
		}
		return properties;
	}
}
